import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import 'package:flutter_demo/login/login_phone/view.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../../public_util.dart';
import 'action.dart';
import 'state.dart';

Widget buildView(
    ExchangeDetailState state, Dispatch dispatch, ViewService viewService) {
  return Scaffold(
    backgroundColor: Colors.white,
    appBar: AppBar(
      title: Text(
        '收货地址',
        style: TextStyle(
            color: Color.fromRGBO(47, 47, 47, 1),
            fontSize: setSp(16),
            fontWeight: FontWeight.bold),
      ),
      leading: GestureDetector(
          onTap: () {
            Navigator.pop(viewService.context);
          },
          child: Icon(Icons.arrow_back_ios_rounded,
              color: Color.fromRGBO(47, 47, 47, 1))),
      centerTitle: true,
      backgroundColor: Colors.white,
      elevation: 0.0,
      brightness: Brightness.light,
    ),
    body: Column(
      children: [
        GestureDetector(
          onTap: () {
            Navigator.pushNamed(viewService.context, 'task_address');
            },
          child: Container(
            color: Colors.white,
            padding: EdgeInsets.fromLTRB(
                setWidth(20), setWidth(10), setWidth(20), setWidth(10)),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Container(
                  child: Text(
                    '请选择收货地址',
                    style: TextStyle(
                      fontSize: setSp(14),
                      color: Color.fromRGBO(47, 47, 47, 1),
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                ),
                Image.asset(
                  'assets/images/user_center/task_sign_right.png',
                  width: setWidth(8),
                  height: setWidth(8),
                ),
              ],
            ),
          ),
        ),
        Container(
          height: setWidth(10),
          color: Color.fromRGBO(248, 248, 248, 1),
        ),
        Container(
          width: ScreenUtil.screenWidth,
          color: Colors.white,
          padding: EdgeInsets.fromLTRB(
              setWidth(20), setWidth(10), setWidth(20), setWidth(10)),
          child: Text(
            '兑换物品',
            style: TextStyle(
              fontSize: setSp(14),
              color: Color.fromRGBO(47, 47, 47, 1),
              fontWeight: FontWeight.bold,
            ),
          ),
        ),
        Container(
          margin: EdgeInsets.symmetric(horizontal: setWidth(15)),
          height: setWidth(0.5),
          color: Color.fromRGBO(248, 248, 248, 1),
        ),
        Container(
          padding: EdgeInsets.symmetric(horizontal: setWidth(20),vertical: setWidth(15)),
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.start,
         children: [
            ClipRRect(
              borderRadius: BorderRadius.all(
                Radius.circular(setWidth(10))),
              child: Image.network(
                "https://img.gzzhitu.com/zhitu-api/1622894340675195.jpg",
                height: 70,
                width: 70,
                fit: BoxFit.cover,
              ),
            ),
           SizedBox(
             width: setWidth(10),
           ),
           Expanded(
             child: Column(
               crossAxisAlignment: CrossAxisAlignment.start,
               children: [
                 Text(
                   '拉面说拉面省心组合装',
                   style: TextStyle(
                       color: Color.fromRGBO(47, 47, 47, 1),
                       fontSize: setSp(14),
                       fontWeight: FontWeight.bold),
                 ),
                 SizedBox(
                   height: setWidth(10),
                 ),
                 Text.rich(
                   TextSpan(
                     children: [
                       TextSpan(
                         text: "X ",
                         style: TextStyle(
                           color: Color.fromRGBO(153, 153, 153, 1),
                           fontSize: setSp(8),
                           fontWeight: FontWeight.bold,
                         ),
                       ),
                       TextSpan(
                         text: '1',
                         style: TextStyle(
                           color: Color.fromRGBO(153, 153, 153, 1),
                           fontSize: setSp(11),
                           fontWeight: FontWeight.bold,
                         ),
                       ),
                     ],
                   ),
                 ),
               ],
             ),
           )
           ],
          ),
        ),
        Container(
          color: Colors.white,
          padding: EdgeInsets.fromLTRB(
              setWidth(20), setWidth(5), setWidth(20), setWidth(30)),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Container(
                child: Text(
                  '兑换方式',
                  style: TextStyle(
                    fontSize: setSp(14),
                    color: Color.fromRGBO(47, 47, 47, 1),
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ),
              Text(
                '积分 -8000',
                style: TextStyle(
                  fontSize: setSp(14),
                  color: Color.fromRGBO(255, 37, 38, 1),
                ),
              )
            ],
          ),
        ),
        Container(
          color: Colors.white,
          padding: EdgeInsets.fromLTRB(
              setWidth(20), 0, setWidth(20), 0),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Container(
                child: Text(
                  '配送方式',
                  style: TextStyle(
                    fontSize: setSp(14),
                    color: Color.fromRGBO(47, 47, 47, 1),
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ),
              Text(
                '快递包邮',
                style: TextStyle(
                  fontSize: setSp(14),
                  color: Color.fromRGBO(255, 37, 38, 1),
                ),
              )
            ],
          ),
        ),
        Expanded(child: Container(),),
        InkWell(
          onTap: () {
            Navigator.pushNamed(viewService.context, 'exchange_detail');
          },
          child: Container(
            height: setWidth(45),
            margin: EdgeInsets.only(bottom: setWidth(40),left: setWidth(15),right: setWidth(15)),
            alignment: Alignment.center,
            decoration: BoxDecoration(
              color: Color.fromRGBO(255, 37, 38, 1),
              borderRadius: BorderRadius.circular(setWidth(45)),
            ),
            child: Text(
              '确定',
              style: TextStyle(
                fontSize: setSp(15),
                color: Colors.white,
              ),
            ),
          ),
        )
      ],
    ),
  );
}
